*** First survey ***
use "$data/survey1_clean.dta", clear

gen ind_worry_perecon = worry_perecon>2
gen ind_worry_corona_econ = worry_corona_econ>2
gen ind_impact_1 = impact_1>3
gen ind_impact_2 = impact_2>3


preserve 
collapse ind_worry_perecon ind_worry_corona_econ ind_impact_1 ind_impact_2, by(male)
gen date = 1
save "$figures/raw/opinions_male_1.dta", replace
restore

preserve 
gen ageold = age>=5
collapse ind_worry_perecon ind_worry_corona_econ ind_impact_1 ind_impact_2, by(ageold)
gen date = 1
save "$figures/raw/opinions_ageold_1.dta", replace
restore


preserve 
keep if democrat==1 | republican ==1 
gen political = ""
replace political = "democrat" if democrat==1
replace political = "republican" if republican==1

collapse ind_worry_perecon ind_worry_corona_econ ind_impact_1 ind_impact_2, by(political)
gen date = 1
save "$figures/raw/opinions_political_1.dta", replace
restore


*** Second survey ***

use "$data/survey2_clean.dta", clear

gen ind_worry_perecon = worry_perecon>2
gen ind_worry_corona_econ = worry_corona_econ>2
gen ind_impact_1 = impact_1>3
gen ind_impact_2 = impact_2>3


preserve 
collapse ind_worry_perecon ind_worry_corona_econ ind_impact_1 ind_impact_2, by(male)
gen date = 2
append using "$figures/raw/opinions_male_1.dta"
sort date
save "$figures/raw/opinions_male.dta", replace
restore

preserve 
gen ageold = age>=5
collapse ind_worry_perecon ind_worry_corona_econ ind_impact_1 ind_impact_2, by(ageold)
gen date = 2
append using "$figures/raw/opinions_ageold_1.dta"
sort date
save "$figures/raw/opinions_ageold.dta", replace
restore


preserve 
keep if democrat==1 | republican ==1 
gen political = ""
replace political = "democrat" if democrat==1
replace political = "republican" if republican==1
collapse ind_worry_perecon ind_worry_corona_econ ind_impact_1 ind_impact_2, by(political)
gen date = 2
append using "$figures/raw/opinions_political_1.dta"
sort date
save "$figures/raw/opinions_political.dta", replace
restore







